



#define MAX_SIZE 100

typedef struct {
    int data[MAX_SIZE];
    int top;
} Stack;

void initStack(Stack *s) {
    s->top = -1;
}


int isEmpty(Stack *s) {
    return s->top == -1;
}



int isFull(Stack *s) {
    return s->top == MAX_SIZE - 1;
}



void push(Stack *s, int value) {
    if (isFull(s)) {
        printf("Stack is full.\n");
    } else {
        s->top++;
        s->data[s->top] = value;
    }
}


int pop(Stack *s) {
    int value;
    if (isEmpty(s)) {
        printf("Stack is empty.\n");
        return -1;
    } else {
        value = s->data[s->top];
        s->top--;
        return value;
    }
}



int top(Stack *s) {
    if (isEmpty(s)) {
        printf("Stack is empty.\n");
        return -1;
    } else {
        return s->data[s->top];
    }
}




int size(Stack *s) {
    return s->top + 1;
}


